#pragma once

#include <string>
#include <ctime>
#include <iostream>
#include <cstdarg>

enum
{
    Dubug = 0,
    Info,
    Warning,
    Error,
    Fatal
};

std::string LevelToString(int level)
{
    switch (level)
    {
    case Dubug:
        return "Dubug";
        break;
    case Info:
        return "Info";
        break;
    case Warning:
        return "Warning";
        break;
    case Error:
        return "Error";
        break;
    case Fatal:
        return "Fatal";
        break;
    default:
        return "unKnown";
    }
}

class Log
{
public:
    Log()
    {
    }

    // 打印日志接口
    void LogMessage(int level, const char *format, ...)
    {
        char content[1024];
        va_list args;
        va_start(args, format);
        vsnprintf(content, sizeof(content), format, args);
        va_end(args);

        uint64_t currtime;
        printf("[%s][%s][%s]", LevelToString(level).c_str(),std::to_string(currtime).c_str(), content);
    }

    ~Log()
    {
    }
};